package com.elontian.client;

import android.graphics.Bitmap;
import android.widget.ImageView;

import com.elontian.cache.AsyncImageCache;
import com.elontian.callBack.LoadImgCallBack;
import com.elontian.util.BitMapUtil;
import com.elontian.util.CheckUtil;

public final class CacheImageClient {

	public static void loadImg(String url, ImageView view, int outw, int outh,
			final LoadImgCallBack callBack) {

		AsyncImageCache.newStance().loadBitmap(url, view, outw, outh, callBack);

	}

	public static void cache(ImageView imgView) {

		String url = (String) imgView.getTag();
		if (CheckUtil.isNotNullString(url)) {
			return;
		}

		Bitmap bitmap = BitMapUtil.getImageViewBitmap(imgView);
		if (CheckUtil.isNotNullBitmap(bitmap)) {
			return;
		}

		AsyncImageCache.newStance().cache(url, bitmap);

	}

}
